<?php
    use User\Model\MeetingModel;
?>
<!-- page heading start-->
<div class="page-heading">
    <h3>
        中奖名单
    </h3>

</div>
<!-- page heading end-->
<div class="row">
    <div class="col-sm-12">
        <section class="panel">
            <header class="panel-heading">
                <input type="button" class="btn btn-default" value="导出" onclick="return download(<?php echo I('get.meetId', -1, '');?>);">
                <!--<a class="btn btn-default" href="/User/Meeting/meetingAdd">增加</a>-->
            </header>
            <div class="panel-body">
                <table class="table table-hover general-table table-bordered">
                    <thead>
                    <tr>
                        <th width="15%">奖项名称</th>
                        <th width="15%">用户信息</th>
                        <th width="15%">中奖时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach($list as $val){?>
                    <tr>
                        <td>
                            <span>
                                <?php
                                if(array_key_exists($val['item_id'], $item_list)){
                                    echo $item_list[$val['item_id']];
                                }else{
                                    echo '';
                                }
                            ?>
                            </span>
                        </td>
                        <td>
                            <span>
                                <?php
                                if(array_key_exists($val['user_id'], $user_list)){
                                    echo $user_list[$val['user_id']]['query_value1'] . " " . $user_list[$val['user_id']]['query_value2'];
                                }else{
                                    echo '';
                                }
                            ?>
                            </span>
                        </td>
                        <td>
                            <span>
                                <?php
                                echo $val['create_time'];
                            ?>
                            </span>
                        </td>
                        <td>
                            <div>
                                <a class="btn btn-info" href="#"
                                   onclick="<?php echo 'return delete_data(' . $val['zj_id'] .')';?>">删除</a>
                            </div>
                        </td>
                    </tr>
                    <?php }?>

                    </tbody>
                </table>
                <div class="pages">
                    {$page}
                </div>
            </div>
        </section>
    </div>
</div>
<script>
    function delete_data(id){
        $.ajax({
            data:{zjId:id},
            dataType:'json',
            url:'/User/Meeting/luckyUserDelete',
            type:'get',
            success:function(res){
                window.location.reload();
            }
        });
        return false;
    }
    function download(id){
        window.location = '/User/Meeting/lucky_user_download?meetId=' + id;
        return false;
    }
</script>